package com.cloud.code;

import lombok.SneakyThrows;

import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.*;

public class PaiXu {


    @SneakyThrows
    public static void main(String[] args) {

        Path path = Paths.get("C:\\Users\\JIE\\Desktop\\wenxian.txt");
        List<String> list = Files.readAllLines(path);

        TreeMap<String,String> map = new TreeMap<>();
        list.forEach(tem->{
            int i = tem.indexOf(",");
            String substring = tem.substring(i+1, tem.length() - 1);
            if(substring.length() > 15){
                int i1 = substring.indexOf(",");
                substring = substring.substring(i1+1, substring.length() - 1);
                if(substring.length() > 15){
                    int i2 = substring.indexOf(",");
                    substring = substring.substring(i2+1, substring.length() - 1);
                }
            }
            map.put(substring,tem);
        });
        NavigableMap<String, String> stringStringNavigableMap = map.descendingMap();
        Set<Map.Entry<String, String>> entries = stringStringNavigableMap.entrySet();
        int i = 1;
        Iterator<Map.Entry<String, String>> iterator = entries.iterator();
        while (iterator.hasNext()){
            String value = iterator.next().getValue();
            int i1 = value.indexOf("]");
            String substring = value.substring(i1+1);
            System.out.println("["+i+"]"+substring);
            i++;
        }

    }
}
